package exser;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.HashMap;

/**
 * @author: knowno
 * @create: 2025-09-17 10:45
 * @Version 1.0
 **/
public class TestDerSerializable2 {
    public static void main(String[] args) {

        try {
            //1 ObjectInputStream对象创建
            ObjectInputStream ois = new ObjectInputStream(new FileInputStream("user.txt"));
           //2 调用readObject方法实现反序列化操作
            HashMap<String,User> map = (HashMap) ois.readObject();
            System.out.println(map);
            //3 释放资源
            ois.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

    }
}
